package com.business.business.web.web;

import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.business.business.common.base.BaseController;
import com.business.business.model.EmgMaterials;
import com.business.business.support.annotaion.Action;
import com.business.business.support.model.RespEntity;
import com.business.business.support.utils.https.StringUtil;
import com.business.business.support.utils.requestutil.HttpRequestUtil;
import com.business.business.web.service.EmgPlaceService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.Arrays;

import static com.business.business.support.utils.WebUtil.getRequest;

/**
 * @Author xulumin
 * @Date 2024/3/20 11:29
 * @Version 1.0
 * @Desc 应急场所控制器
 */
@Controller
@Action
@RequestMapping(value = "emergencyPlace")
public class EmgPlaceController extends BaseController {

    @Resource
    private EmgPlaceService emgPlaceService;

    /**
     * Author: xulumin
     * Date: 2024/3/19
     * Description: 应急场所新增或者更新
     */
    @PostMapping("addOrUpdatePlace")
    public RespEntity addOrUpdatePlace(@RequestBody(required = false) JSONObject jsonObject) throws IllegalAccessException, InstantiationException {
        return emgPlaceService.addOrUpdatePlace(jsonObject);
    }

    /**
     * Author: xulumin
     * Date: 2024/3/19
     * Description: 应急场所物资信息列表
     */
    @GetMapping("getPlaceList")
    public RespEntity getPlaceList(@RequestBody(required = false) JSONObject jsonObject) {
        return emgPlaceService.getPlaceList(jsonObject);
    }

    /**
     * Author: xulumin
     * Date: 2024/3/20
     * Description: 获取应急场所
     */
    @GetMapping("getPlaceInfo")
    public RespEntity getPlaceInfo(@RequestBody(required = false) JSONObject jsonObject) {
        return emgPlaceService.getPlaceInfo(jsonObject);
    }

    /**
     * Author: xulumin
     * Date: 2024/3/19
     * Description: 删除应急场所信息
     */
    @PostMapping("delPlace")
    public RespEntity delPlace(@RequestBody(required = false) JSONObject jsonObject) {
        return emgPlaceService.delPlace(jsonObject);
    }
}
